package ex_1_synchronizedMethodLockObject;

public class Main {
    /**
     *
     * A线程先持有object对象得lock锁，B线程可以异步调用object对象中的非Synchronized类型方法;
     * A线程先持有object对象得lock锁，B线程如果调研object对象中的Synchronized类型方法需要等待，也就是同步。
     *
     */
    public static void main(String[] args) {
        MyObject myObject = new MyObject();
        ThreadA threadA = new ThreadA(myObject);
        threadA.setName("A");
        ThreadB threadB = new ThreadB(myObject);
        threadB.setName("B");
        threadA.start();
        threadB.start();
    }
}
